<?php
/*
 * @Description    : Redis缓存清除服务类
 * @Version        : 1.0.0
 * @Author         : QianLong
 * @Date           : 2019-11-08 00:04:40
 * @LastEditors    : QianLong
 * @LastEditTime   : 2020-10-09 16:53:05
 */

namespace App\Service;

class ClearRedisCache
{
    public function clearTaokeSessionByAccount($taokeAccount)
    {
        redis()->del('openmqt_TaoKeAuthSession-' . $taokeAccount);
        unset( $taokeAccount);
    }
    public function clearTaokeSessionByTaobaoUserId($userId)
    {
        redis()->del('openmqt_TaoKeAuthSession-' . $userId);
        unset($userId);
    }
    public function clearNuoNuoTokenByKey($key)
    {
        redis()->del('openmqt_NuoNuoAuthInfo-' . $key);
        unset($userId);
    }
    public function clearTaokeAccountByAppkey($appkey)
    {
        redis()->del('openmqt_TaoKeAuthSession-' . $appkey);
        unset($appkey);
    }
    public function clearPDDAuthKeyByAccountName($accountName)
    {
        redis()->del('openmqt_pdd_oauth_key-' . $accountName);
        unset($accountName);
    }
    public function clearPlatformSetting()
    {
        redis()->del('openmqt_platformSettingCache');
    }
    /**
     * 删除用户设置
     */
    public function delUserSettingByUid($userId)
    {
        redis()->hdel('openmqt_auserank', $userId);
        redis()->hdel('openmqt_user_setting', $userId);
        redis()->del('openmqt_userRankInfo-' . $userId);
        redis()->del('openmqt_userInfo-' . $userId);
    }
    /**
     * 通过账号删除淘客session缓存
     */
    public function delTaokeSessionCacheByAccount($taokeAccount)
    {
        redis()->del('openmqt_TaoKeAuthKey-' . $taokeAccount);
        redis()->del('openmqt_TaoKeAuthSession-' . $taokeAccount);
        redis()->hdel('openmqt_oauth_key', $taokeAccount);
    }
    /**
     * 通过账号ID删除淘客session缓存
     */
    public function delTaokeSessionCacheByUserId($taokeUserId)
    {
        redis()->del('openmqt_TaoKeUserId-' . $taokeUserId);
        redis()->hdel('openmqt_oauth_key', $taokeUserId);
        redis()->hdel('hsh_oauth_key', $taokeUserId);
    }
    /**
     * 通过账号ID删除淘客session缓存
     */
    public function delJingDongAuthKeyById($id)
    {
        redis()->hdel('openmqt_jdsqkeyinfo', $id);
        redis()->del('openmqt_jdsqinfobykey' . $id);
        redis()->del('openmqt_jdAuthKeyInfoById-' . $id);
    }
}
